package com.human.controller;


import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.human.entity.ResultVo;
import com.human.entity.Salary;
import com.human.service.ISalaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 工资账套 前端控制器
 * </p>
 *
 * @author jzq
 * @since 2023-03-07
 */
@RestController
@RequestMapping("/api/salary")
@Api(tags = "工资账套")
@ApiSupport(order = 5)
public class SalaryController {

    @Autowired
    ISalaryService salaryService;

    @GetMapping("/getOne")
    @ApiOperation(value = "根据ID查询工资账套")
    public ResultVo getSalaryById(Integer id) {
        return salaryService.getSalaryById(id);
    }

    @GetMapping("/getAll")
    @ApiOperation(value = "查询所有工资账套")
    public ResultVo getAllSalary() {
        return salaryService.getAllSalary();
    }

    @PostMapping("/addSalayr")
    @ApiOperation(value = "添加工资账套")
    public ResultVo addSalary(@RequestBody Salary salary) {
        return salaryService.addSalary(salary);
    }

    @PutMapping("/updateSalary")
    @ApiOperation(value = "修改工资账套")
    public ResultVo updateSalary(@RequestBody Salary salary) {
        return salaryService.updateSalary(salary);
    }

    @DeleteMapping("/{id}")
    @ApiOperation(value = "根据ID删除工资账套")
    public ResultVo deleteSalaryById(@PathVariable("id") Integer id) {
        return salaryService.deleteSalaryById(id);
    }

}

